package com.pets.web.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pets.web.config.CDNUrlsJsonSerializer;
import com.pets.web.dto.CreateOrderDto;
import com.pets.web.enums.OrderCommentStatusEnums;
import com.pets.web.enums.OrderStatusEnums;
import com.pets.web.enums.OrderTypeEnums;
import com.pets.web.vo.CreateOrderRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.validation.annotation.Validated;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author zhurenwang
 * @since 2024-05-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("pets_orders")
@ApiModel(value="PetOrders对象", description="订单表")
public class PetsOrders implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @ApiModelProperty(value = "0-为报恩寺购买 1-为自己购买")
    private OrderTypeEnums type;

    @ApiModelProperty(value = "用户id")
    private Integer userId;

    @ApiModelProperty(value = "openId")
    private String openId;

    @ApiModelProperty(value = "用户昵称")
    private String nickname;

    @ApiModelProperty(value = "用户头像")
    private String avatar;

    @ApiModelProperty(value = "商品id")
    private Integer goodsId;

    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ApiModelProperty(value = "商品价格")
    private BigDecimal goodsPrice;

    @ApiModelProperty(value = "购买数量")
    private Integer num;

    @ApiModelProperty(value = "支付金额")
    private BigDecimal payAmount;

    @ApiModelProperty(value = "重量KG")
    private Integer weight;

    @ApiModelProperty(value = "订单状态 0-未支付 1-已支付 2-已发货 3-已收货")
    private OrderStatusEnums status;

    @ApiModelProperty(value = "评论状态 0-未评论 1-已评论")
    private OrderCommentStatusEnums commentStatus;

    @ApiModelProperty(value = "用户姓名")
    private String name;

    @ApiModelProperty(value = "用户手机号")
    private String phone;

    @ApiModelProperty(value = "用户地址")
    private String address;

    @ApiModelProperty(value = "系统用户id")
    private Long sysUserId;

    @ApiModelProperty(value = "平台code")
    private String pfCode;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "店铺名称")
    @TableField(exist = false)
    private String shopName;

    @TableField(exist = false)
    @ApiModelProperty(value = "店铺头像")
    //@JsonSerialize(using = CDNUrlsJsonSerializer.class)
    private String shopAvatar;

    @ApiModelProperty(value = "商品主图")
    @TableField(exist = false)
    private String mainImage;

}
